//
//  UPCustomAlertView.h
//  Uang Pasti
//
//  Created by 李永彬 on 2025/8/18.
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSInteger, UPAlertViewStyle) {
    UPAlertViewStyleCenter,
    UPAlertViewStyleBottomSheet
};

typedef NS_ENUM(NSInteger, UPButtonStyle) {
    UPButtonStyleDefault,     // 蓝底白字
    UPButtonStyleDestructive, // 红底白字
    UPButtonStyleCancel,      // 灰底白字
    UPButtonStyleCustom       // 完全自定义
};

NS_ASSUME_NONNULL_BEGIN

typedef void(^PrivacyTapBlock)(void);
@interface UPCustomAlertView : UIView

/// 初始化方法
/// @param backgroundImage 背景图片（决定弹窗大小）
/// @param style 弹窗样式
- (instancetype)initWithBackgroundImage:(UIImage * _Nullable)backgroundImage
                                  style:(UPAlertViewStyle)style;

/// 使用自定义视图初始化
/// @param customView 自定义视图
/// @param style 弹窗样式
- (instancetype)initWithCustomView:(UIView *)customView
                             style:(UPAlertViewStyle)style;

/// 设置标题
- (void)setTitle:(NSString *)title
            font:(UIFont * _Nullable)font;

/// 设置内容
- (void)setContent:(NSString *)content
              font:(UIFont * _Nullable)font;

/// 添加按钮（使用预设样式）
- (void)addButtonWithTitle:(NSString *)title
                     style:(UPButtonStyle)style
                   handler:(void(^_Nullable)(void))handler;

/// 添加按钮（完全自定义样式）
- (void)addButtonWithTitle:(NSString *)title
     normalBackgroundColor:(UIColor *)normalColor
                     image:(UIImage *)image
                titleColor:(UIColor *)titleColor
                      font:(UIFont * _Nullable)font
                   handler:(void(^_Nullable)(void))handler;

/// 显示弹窗
- (void)showInView:(UIView *)superView;

/// 隐藏弹窗
- (void)dismiss;

@property (nonatomic, assign, readonly) BOOL isAlertVisiable;
@property (nonatomic, assign) BOOL showPrivacy;
@property (nonatomic, copy) PrivacyTapBlock privacyTapBlock;
@property (nonatomic, assign, readonly) BOOL isPrivacySelected;
@property (nonatomic, assign) BOOL isButtonClickDismiss;

@end

NS_ASSUME_NONNULL_END
